<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script>

<title>用户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理<span class="c-gray en"></span><a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="list" method="post" class="form form-horizontal" id="form-strategy-list">
		<div class="text-c" style="display:flex;align-items:center">
			<input type="text" class="input-text" style="width:150px" placeholder="姓名" id="name" name="name" value="${member.name }">
			&nbsp;&nbsp;&nbsp;
			<input type="text" class="input-text" style="width:150px" placeholder="电话" id="tel" name="tel" value="${member.tel }">
			&nbsp;&nbsp;&nbsp;
			<input type="text" class="input-text" style="width:150px" placeholder="推广人姓名" id="pname" name="pname" value="${member.pname }">
			&nbsp;&nbsp;&nbsp;
			<input type="text" class="input-text" style="width:150px" placeholder="推广人电话" id="ptel" name="ptel" value="${member.ptel }">
			&nbsp;&nbsp;&nbsp;
			<span>状态：</span>
			<span class="select-box" style="width:150px">
				  <select class="select" size="1" name="disabled" id="disabled">
				    <option value="" selected>请选择</option>
				    <option value="0" <c:if test="${member.disabled==0 }">selected=selected</c:if> >未激活</option>
				    <option value="1" <c:if test="${member.disabled==1 }">selected=selected</c:if> >已激活</option>
				  </select>
			</span>
			<div class="text-c"> 日期选择：
			<input type="text" onfocus="WdatePicker()" id="starttime" name="starttime"  value="${member.starttime }" class="input-text Wdate" style="width:120px;">
			-
			<input type="text" onfocus="WdatePicker()" id="endtime" name="endtime"  value="${member.endtime }" class="input-text Wdate" style="width:120px;">
</div>
			<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>搜索</button>
		</div>
		
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
		<span class="l">
		   <c:if test="${button166t167t1}">
			<a href="javascript:;" onclick="admin_permission_add('新增','before?forwardflag=add&id=0')" class="btn btn-primary radius">
				<i class="Hui-iconfont">&#xe600;</i> 新增
			</a> 
			<a href="javascript:;" onclick="admin_permission_add('批量导入','inExcelImportPage',500,400)" class="btn btn-success radius"><i class="Hui-iconfont">&#xe645;</i> 批量导入</a>
			</c:if>
		</span> 
		<span class="r">共有数据：<strong>${fn:length(memberList) }</strong> 条</span> 
	</div>
	<br/>
	
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
				<th scope="col" colspan="12">成员列表</th>
			</tr>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th width="40">序号</th>
				<th width="40">姓名</th>
				<th width="40">手机号</th>
				<th width="40">性别</th>
				<th width="40">团队成员</th>
				<th width="40">等级</th>
				<th width="40">销售金额</th>
				<th width="40">推广人姓名</th>
				<th width="40">推广人手机</th>
				<th width="40">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:set var="sum" value="0"></c:set>
			<c:set var="sum1" value="0"></c:set>
			<c:forEach var="member" items="${memberList }" varStatus="index">
			<tr class="text-c">
				<td><input type="checkbox" value="${member.id }" name="memberids"></td>
				<td>${member.num }</td>
				<td>${member.name }</td>
				<td><a href="#" onclick="saledetail('${member.id }')">${member.tel }</a></td>
				<td>
					<c:if test="${member.sex  == 1}">
						男
					</c:if>
					<c:if test="${member.sex  == 2}">
						女
					</c:if>
				</td>
				<td>${member.membernum }</td>
				<td>
					<c:if test="${member.level  == 1}">
						天使合伙人
					</c:if>
					<c:if test="${member.level  == 2}">
						总监
					</c:if>
					<c:if test="${member.level  == 3}">
						名誉总监
					</c:if>
					<c:if test="${member.level  == 4}">
						督导
					</c:if>
					<c:if test="${member.level  == 5}">
						名誉督导
					</c:if>
					<c:if test="${member.level  == 6}">
						董事
					</c:if>
					<c:if test="${member.level  == 7}">
						名誉董事
					</c:if>
				</td>
				<td>${member.saleamount }</td>
				<td>${member.pname }</td>
				<td>${member.ptel }</td>
				<td>
					<c:if test="${member.disabled  == 1}">
						已激活
					</c:if>
					<c:if test="${member.disabled  == 0}">
						未激活
					</c:if>
					<c:if test="${member.disabled  == 2}">
						已撤销
					</c:if>
				</td>
				<td>
				<c:if test="${button166t167t3}">
					<c:if test="${member.status  == 1}">
						<a title="冻结" href="javascript:;" onclick="changgeStatus('${member.id }',0)" class="ml-5" style="text-decoration:none">
							<i class="btn btn-warning radius">冻结</i>
						</a>
					</c:if>
					<c:if test="${member.status  == 0}">
						<a title="解冻" href="javascript:;" onclick="changgeStatus('${member.id }',1)" class="ml-5" style="text-decoration:none">
							<i class="btn btn-warning radius">解冻</i>
						</a>
					</c:if>
				</c:if>
				<c:if test="${button166t167t4}">	
					<a title="重置密码" href="javascript:;" onclick="resetPassword('${member.id }')" class="ml-5" style="text-decoration:none">
						<i class="btn btn-warning radius">重置密码</i>
					</a>
				</c:if>
				<c:if test="${button166t167t5}">	
					<a title="销售" href="javascript:;" onclick="shoppingbefore('销售','shoppingbefore?forwardflag=upd&id=${member.id}')" class="ml-5" style="text-decoration:none">
						<i class="btn btn-warning radius">销售</i>
					</a>
				</c:if>
				</td>
			</tr>
			<c:set var="sum" value="${sum+member.saleamount}"></c:set>
			<c:set var="sum1" value="${sum1+member.membernum}"></c:set>
			</c:forEach>
		</tbody>
	</table>
	<table>
		<tr><td width="33%"></td><td width="33%">团队成员合计：${fn:length(memberList) }</td><td>销售金额合计：${sum }</td></tr>
	</table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript">
$('.table-sort').dataTable({                         
	"aaSorting": [[ 1, "asc" ]],//默认第几个排序
	"searching":false,//搜索输入框显示
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[2,0]},// 制定列不参与排序
	  {"orderable":false,"aTargets":[2,2]},// 制定列不参与排序
	  {"orderable":false,"aTargets":[2,3]},// 制定列不参与排序
	]
});


function saledetail(memberid){
	layer_show("详情",'${ctx}/member/homepage1?memberid='+memberid,700,700);
}

/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
/*通知公告-通知列表-添加*/
function admin_permission_add(title,url,w,h){
	layer_show(title,url,w,h);
} 
/*通知公告-通知列表-购买*/
function shoppingbefore(title,url,id,w,h){
	if(id==0 || id==""){
		alert("参数不正确");
		return;
	}
	layer_show(title,url,500,300);
}
 
/*通知公告-通知列表-重置密码*/
function resetPassword(id){
	layer.confirm('确认要重置密码吗？',function(index){
		$.ajax({
			type: 'POST',
			url: 'resetPassword',
			data:{'id':id},
			dataType: 'json',
			success: function(data){
				if(data.status == 'success'){
					layer.msg(data.desc+"!<script>setTimeout('window.location.reload();',1100);<\/script>", {icon: 6,time:1150});
				}else{
					layer.msg(data.desc+"!<script>setTimeout('window.location.reload();',1100);<\/script>", {icon: 6,time:1150});
				}
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}

/*通知公告-通知列表-冻结/解冻账户*/
function changgeStatus(id,status){
	layer.confirm('确认要进行操作吗？',function(index){
		$.ajax({
			type: 'POST',
			url: 'frozenAccount',
			data:{"id":id,"status":status},
			async: false,
			dataType: 'json',
			success: function(data){
				if(data.status == 'success'){
					layer.msg(data.desc+"!<script>setTimeout('window.location.reload();',1100);<\/script>", {icon: 6,time:1150});
				}else{
					layer.msg(data.desc+"!<script>setTimeout('window.location.reload();',1100);<\/script>", {icon: 6,time:1150});
				}
			},
			error:function(data) {
				console.log(data.msg);
			}
		});		
	});
}


</script>
</body>
</html>